package com.molichuxing.services.property;

/**
 * 
 * @author liyg 库存状态枚举类
 *
 */
public enum StockRecordStatusEnum {

	/**
	 * 待入库
	 */
	WAIT_STOCK(0,"待入库"),
	
	/**
	 *入库
	 */
	IN_STOCK (1, "入库"),
	
	/**
	 * 出库
	 */
	OUT_STOCK(2, "出库");

	
	int value;
	String name;

	StockRecordStatusEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public int getValue() {
		return value;
	}

	public String getName() {
		return name;
	}


	/**
	 * 通过value获取枚举的name
	 * 
	 * @param value
	 * @return
	 */
	public static String getName(int value) {
		StockRecordStatusEnum enumerate = getEnum(value);
		return enumerate == null ? null : enumerate.getName();
	}

	/**
	 * 通过value获取枚举
	 * 
	 * @param value
	 * @return
	 */
	public static StockRecordStatusEnum getEnum(int value) {
		for (StockRecordStatusEnum enumerate : StockRecordStatusEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate;
			}
		}
		return null;
	}
}
